home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / windows / fc_11f.zip / WWWZIP.DL$ < prev    next >
Text File  |  1992-07-29  |  9KB  |  241 lines

  1. ; WWWZIP.DLL
  2.     ErrMsg=""
  3.     If !FileExist("wwwdos.bat")   Then ErrMsg="WWWDOS.BAT   not found"
  4.     If !FileExist("wwwdosp.pif")  Then ErrMsg="WWWDOSP.PIF  not found"
  5.     If !FileExist("wwwdosc.pif")  Then ErrMsg="WWWDOSC.PIF  not found"
  6.     If !FileExist("wwwzipls.exe") Then ErrMsg="WWWZIPLS.EXE not found"
  7.     If !FileExist("pkzip.exe")    Then ErrMsg="PKZIP.EXE    not found"
  8.     If !FileExist("pkunzip.exe")  Then ErrMsg="PKUNZIP.EXE  not found"
  9.     If !FileExist("browser.exe")  Then ErrMsg="BROWSER.EXE  not found"
  10.     If ErrMsg!="" Then Goto ShowError
  11.  
  12.         goto %param1%     ; must be ZIP or UNZIP
  13.  
  14. :ZIP
  15.         DaMove=" -a "
  16.         DaDirs=""
  17.         DaWho="*.*"
  18.         DaZip=""
  19.         DaRefresh=0
  20.         DaTitle="Files"
  21.         param3=strlower(param3)
  22.         if param3=="move" then DaMove=" -m "
  23.         goto %param2%         ; Must be CURRENT, DIR, SUBDIR, or HILITED
  24.  
  25. :CURRENT
  26.         DaWho=strcat(CurrentPath(),CurrentFile())
  27.         DaZip=strcat(FileRoot(DaWho),".ZIP")
  28.         goto ZIPDO
  29. :SUBDIR
  30.        DaDirs=" -r -p "
  31.        DaRefresh=1
  32.        DaTitle="Structure"
  33.        goto ZIPDO
  34.  
  35. :HILITED
  36.         b=FileItemize("")
  37.         If b=="" Then ErrMsg="Zip Hilited files?  No files hilited!"
  38.                  Then Goto ShowError
  39.         b=strreplace(b," ",CR)
  40.         fp=FileOpen("FC-TEMP9.XCV","WRITE")
  41.         FileWrite(fp,b)
  42.         FileClose(fp)
  43.         Drop(b)
  44.         DaWho="@FC-TEMP9.XCV"
  45.         goto ZIPDO
  46.  
  47. :DIR
  48.        DaTitle="Directory"
  49.        goto ZIPDO
  50.  
  51. :ZIPDO
  52.         DaZip=AskLine("Zip %DaTitle%","Enter desired ZIP name",DaZip)
  53.         if DaZip=="" then goto cancel
  54.         Runwait("wwwdosc.pif","pkzip.exe %DaMove% %DaDirs% %DaZip% %DaWho%")
  55.         if DaWho=="FC-TEMP9.XCV" then FileDelete(DaWho)
  56.         Refresh(DaRefresh)
  57.         Display(3,"Zip %DaTitle%","Complete")
  58.         goto cancel
  59.  
  60. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  61. :UNZIP
  62.  
  63.        ViewFlag=0
  64.        zipsort=param3
  65.        goto %param2%    ; must be ALL, VIEW, or INDIV
  66.  
  67. :ALL
  68.         zipfile=strcat(CurrentPath(),CurrentFile())
  69.         if FileExtension(zipfile)=="ZIP" then goto alldoit
  70.         zipfile=FileItemize("*.zip")
  71.         If zipfile=="" Then ErrMsg="UnZip files?  No zip files found!"
  72.                  Then Goto ShowError
  73.         zipfile=itemselect("Select file to UnZip",zipfile," ")
  74.         if zipfile=="" then goto cancel
  75. :alldoit
  76.         if param3==2 then goto allspec
  77.         runwait("wwwdosc.pif","pkunzip.exe -d %zipfile%")
  78.         Refresh(1)
  79.         goto cancel
  80.  
  81. :allspec
  82.         RetHome="allspec1"
  83.         goto DoOptions
  84. :allspec1
  85.         if overwarn==0 then overwarn=" -o "
  86.                        else overwarn=""
  87.         RunWait("wwwdosc.pif", "pkunzip.exe -d %overwarn% %zipfile% %targdir% *.*")
  88.         Refresh(1)
  89.         goto cancel
  90.  
  91.  
  92.  
  93. :INDIV
  94.        ViewFlag=param3
  95.        if ViewFlag==1 then zipsort=1
  96.                       then overwarn=0
  97.                       then targdir=""
  98.                       then goto VIEW
  99.  
  100.         RetHome="VIEW"
  101.         goto DoOptions
  102.  
  103. :VIEW
  104.         workdir = Environment("TEMP")
  105.         If workdir == "" Then workdir = DirWindows(0)
  106.         If StrSub(workdir, StrLen(workdir), 1) != "\" Then workdir = StrCat(workdir, "\")
  107.         if ViewFlag==0 then targdir=workdir
  108.         zipfile=strcat(CurrentPath(),CurrentFile())
  109.         if FileExtension(zipfile)=="ZIP" then goto viewdoit
  110.         zipfile=FileItemize("*.zip")
  111.         If zipfile=="" Then ErrMsg="UnZip files?  No zip files found!"
  112.                  Then Goto ShowError
  113.         if ViewFlag==0 then TSMsg="Select ZIP file to view"
  114.                        else TSMsg="Select ZIP file to use"
  115.         zipfile=itemselect(TSMsg,zipfile," ")
  116.         if zipfile=="" then goto cancel
  117.  
  118. :viewdoit
  119.         ziplist = StrCat(workdir, "wwwunzip.lst")
  120.         If FileExist(ziplist) Then FileDelete(ziplist)
  121.  
  122.         RunWait("wwwzipls.exe","%zipfile% %ziplist% %zipsort%")
  123.         if ViewFlag==0 then TSMsg="Select file to view"
  124.                        else TSMsg="Select file to extract"
  125. :TXSEL
  126.         OldFont=IntControl(28,1,0,0,0)        ; Set fixed pitch font in text box
  127.         member=TextBox(TSMsg,ziplist)
  128.         IntControl(28,OldFont,0,0,0)          ; Restore previous font pitch type
  129.         if member=="" then goto CANCEL
  130.  
  131.         member=strsub(member,46,strlen(member)-45)
  132.         memfile=FileExtension(member)
  133.         if memfile!="" then memfile=strcat(FileRoot(member),".",memfile)
  134.                        else memfile=FileRoot(member)
  135.         
  136.  
  137.         if ViewFlag==0 then goto extract
  138.         if overwarn==0 then goto extract
  139.         If FileExist("%targdir%%memfile%") == @FALSE Then Goto extract
  140.         b= AskYesNo("%member% already exists in %targdir%", "Do you wish to replace it?")
  141.         If b == @NO Then Goto TXSEL
  142.  
  143. :extract
  144.         RunHideWait("wwwdosc.pif", "pkunzip.exe -o %zipfile% %targdir% %member%")
  145.         If !FileExist("%targdir%%memfile%") Then ErrMsg="Problem extracting %member% from ZIP file"
  146.                                            Then Goto ShowError
  147.  
  148.         if ViewFlag!=0 then TSMsg="Extract Another?"
  149.                        then goto TXSEL
  150.         member = StrUpper(StrCat(targdir, memfile))
  151.         RunZoomWait("browser.exe", member)
  152.         FileDelete(member)
  153.         TSMsg="View Another?"
  154.         goto TXSEL
  155.  
  156.  
  157. :SHOWERROR
  158.     Message("Error", ErrMsg)
  159.  
  160. :CANCEL
  161.     if IsDefined(ziplist) then If FileExist(ziplist) Then FileDelete(ziplist)
  162.     Drop(DaMove,DaDirs,DaWho,DaZip,DaRefresh,DaTitle,ViewFlag,zipsort)
  163.     Drop(zipfile,b,RetHome,overwarn,targdir,workdir,ziplist,TSMsg,member)
  164.     Drop(ErrMsg,usecurdir,ThisDir,CheckDir,memfile)
  165.     Drop(ZippyFormat,ZippyCaption,ZippyX,ZippyY,ZippyWidth,ZippyHeight)
  166.     Drop(ZippyNumControls,Zippy01,Zippy02,Zippy03,Zippy04,Zippy05,Zippy06)
  167.     Drop(Zippy07,Zippy08,Zippy09,Zippy10,Zippy11,Zippy12,Zippy13)
  168.     exit
  169. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  170.  
  171. :DOOPTIONS
  172.         zipsort = IniReadPvt("WWWUNZIP", "SortOrder", 1, "www-prod.ini")
  173.         overwarn=IniReadPvt("WWWUNZIP","OverWarn",1,"www-prod.ini")
  174.         whichdir=IniReadPvt("WWWUNZIP","WhichDir",1,"www-prod.ini")
  175.  
  176.         ; Undocumented, new, beta dialog function being used here.  Will
  177.         ; be documented in the 2.0 release.  Good Luck.
  178.  
  179.  
  180.         ZippyFormat=`WWWDLGED,4.0`
  181.  
  182.         ZippyCaption=`Zip Options`
  183.     ZippyX=69
  184.     ZippyY=85
  185.     ZippyWidth=217
  186.     ZippyHeight=115
  187.     ZippyNumControls=13
  188.     Zippy01=`6,18,80,DEFAULT,RADIOBUTTON,whichdir,"Use Current Dir ->",1`
  189.     Zippy02=`6,32,80,DEFAULT,RADIOBUTTON,whichdir,"Use Specified Dir ->",2`
  190.     Zippy03=`86,32,124,DEFAULT,EDITBOX,targdir,""`
  191.     Zippy04=`16,64,56,DEFAULT,RADIOBUTTON,zipsort,"by Name",1`
  192.     Zippy05=`16,76,58,DEFAULT,RADIOBUTTON,zipsort,"by Extension",2`
  193.     Zippy06=`16,88,46,DEFAULT,RADIOBUTTON,zipsort,"by Date",3`
  194.     Zippy07=`16,100,46,DEFAULT,RADIOBUTTON,zipsort,"by Size",4`
  195.     Zippy08=`108,58,80,DEFAULT,CHECKBOX,overwarn,"Warn on Overwrite",1`
  196.  
  197.     Zippy09=`120,78,64,DEFAULT,PUSHBUTTON,DEFAULT,"&Ok",1`
  198.     Zippy10=`120,98,64,DEFAULT,PUSHBUTTON,DEFAULT,"&Cancel",0`
  199.     Zippy11=`6,4,64,DEFAULT,STATICTEXT,NONAME,"Target Directory"`
  200.     Zippy12=`6,52,64,DEFAULT,STATICTEXT,NONAME,"Sort list by:"`
  201.     Zippy13=`88,20,122,DEFAULT,VARYTEXT,ThisDir,""`
  202.  
  203.  
  204. :gettarg
  205.         ; Undocumented, new, beta dialog function being used here.  Will
  206.         ; be documented in the 2.0 release.  Good Luck.
  207.         ThisDir=DirGet()
  208.         targdir = IniReadPvt("WWWUNZIP", "TargetDir", DirGet(), "www-prod.ini")
  209.         Dialog("Zippy")
  210.  
  211.         if whichdir==1 then usecurdir = @YES
  212.                        then targdir=ThisDir
  213.                        else usecurdir = @NO
  214.         targdir = StrUpper(targdir)
  215.         If targdir == "" Then usecurdir = @YES
  216.                          Then targdir = DirGet()
  217.         If StrSub(targdir, StrLen(targdir), 1) != "\" Then targdir = StrCat(targdir, "\")
  218.         If ThisDir==targdir then usecurdir = @YES
  219.                             then goto targok
  220.         DirChange(targdir)
  221.         CheckDir=DirGet()
  222.         DirChange(ThisDir)
  223.         If ThisDir!=CheckDir Then Goto targok
  224.  
  225.         b= AskYesNo("WWWUNZIP", "%targdir% does not exist.  Do you wish to create it?")
  226.         If b == @NO Then Goto gettarg
  227.         DirMake(targdir)
  228.         DirChange(targdir)
  229.         CheckDir=DirGet()
  230.         DirChange(ThisDir)
  231.         If ThisDir!=CheckDir Then Goto targok
  232.         Message("WWWUNZIP","%targdir% could not be created.  Please respecify.")
  233.         goto gettarg
  234.  
  235.         :targok
  236.         If usecurdir == @NO Then IniWritePvt("WWWUNZIP", "TargetDir", targdir, "www-prod.ini")
  237.         IniWritePvt("WWWUNZIP", "SortOrder", zipsort, "www-prod.ini")
  238.         IniWritePvt("WWWUNZIP", "OverWarn", overwarn, "www-prod.ini")
  239.         IniWritePvt("WWWUNZIP", "WhichDir", whichdir, "www-prod.ini")
  240.         goto %RetHome%
  241.